from ronglian_sms_sdk import SmsSDK
import json

# 容联云参数
RONG_LIAN_ACCOUNT_SID = '2c94811c946f6bfb0196a46a61956a46'  # 你的Account SID
RONG_LIAN_AUTH_TOKEN = '7d8eefed17044c35a6d44a869b2992d9'   # 你的Auth Token
RONG_LIAN_APP_ID = '2c94811c946f6bfb0196a46a634e6a4d'       # 你的App ID
RONG_LIAN_TEMPLATE_ID = '1'  # 短信模板ID

def send_sms_code(phone, code, expire_minutes='5'):
    sdk = SmsSDK(RONG_LIAN_ACCOUNT_SID, RONG_LIAN_AUTH_TOKEN, RONG_LIAN_APP_ID)
    resp = sdk.sendMessage(RONG_LIAN_TEMPLATE_ID, phone, (code, expire_minutes))
    if isinstance(resp, str):
        resp = json.loads(resp)
    return resp 